import { MODE } from "@/libs/constants"
export const getToken = function(){
    if(MODE === 'production')
    {
        const token = window.location.href.split('token=')[1].split('&')[0]
        console.log('判断是否token还有么:',token)
        if(token){
            return token
        } else {
            return false
        }
    } else {
        if(document.cookie){
            let cookies = document.cookie.split(';')
            for(let i=0;i<cookies.length;i++){
                let val = cookies[i].split('=')
                if(val[0].indexOf('token') !== -1  && val[1] !== ''){
                    return val[1]
                }
            }
            return false
        }
    }
}